package com.sbtr.business.feature.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.sbtr.business.feature.entity.FeAttributecreateRule;
import com.sbtr.business.feature.dto.FeAttributecreateRuleDto;

import com.sbtr.business.feature.service.FeAttributecreateRuleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sbtr.business.feature.mapper.FeAttributecreateRuleMapper;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.AbstractWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sbtr.common.PageDto;
import com.sbtr.util.PageDtoUtils;
import org.springframework.transaction.annotation.Transactional;

/**
 * 属性生成字段列表 Service接口实现类
 *
 * @author dgl
 * @since  2023-04-06
 */
@Transactional
@Service
public class FeAttributecreateRuleServiceImpl extends ServiceImpl<FeAttributecreateRuleMapper,FeAttributecreateRule> implements FeAttributecreateRuleService {

    @Autowired
    FeAttributecreateRuleMapper feAttributecreateRuleMapper;

    @Override
    public PageDto<FeAttributecreateRule> pageList(FeAttributecreateRuleDto feAttributecreateRuleDto) {

        IPage<FeAttributecreateRule> page = new Page<>();
        page.setSize(feAttributecreateRuleDto.getPageSize());
        page.setCurrent(feAttributecreateRuleDto.getPage());
        page = feAttributecreateRuleMapper.selectPages(page, BeanUtil.beanToMap(feAttributecreateRuleDto));
        PageDto<FeAttributecreateRule> r = PageDtoUtils.getPageDtoByIPage(page, FeAttributecreateRule.class);

        return r;
    }
}

